CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/[owner]/[project]/[...public_path].tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
// Page for a project that is owned by a named account
7
// or organization.
8
9
import getPublicPathId from "lib/names/public-path";
10
import getPublicPathInfo from "lib/share/get-public-path-info";
11
import withCustomize from "lib/with-customize";
12
import PublicPath from "components/path/path";
13
14
export default PublicPath;
15
16
export async function getServerSideProps(context) {
17
const { owner, project, public_path } = context.params;
18
try {
19
const id = await getPublicPathId(owner, project, public_path);
20
const props = await getPublicPathInfo({
21
id,
22
public_path,
23
req: context.req,
24
});
25
return await withCustomize({ context, props });
26
} catch (_err) {
27
return { notFound: true };
28
}
29
}
30
31